using UnityEngine;
using System.Collections;

public class Game : MonoBehaviour {

    int id = 0;

    GameObject fade_in;
    GameObject fade_out;

    void Start()
    {
        this.gameObject.AddComponent("MeshRenderer");
        this.gameObject.AddComponent("MeshFilter");


        Mesh mesh = Quad.Create(4.0f, 3.0f);

        this.gameObject.GetComponent<MeshFilter>().mesh = mesh;
        this.gameObject.GetComponent<MeshRenderer>().material = AtlasManager.globalMaterial;

        this.gameObject.GetComponent<MeshFilter>().mesh.uv = new Vector2[]
		{
			new Vector2(AtlasManager.rects[id].xMin, AtlasManager.rects[id].yMax),
			new Vector2(AtlasManager.rects[id].xMax, AtlasManager.rects[id].yMax),
			new Vector2(AtlasManager.rects[id].xMax, AtlasManager.rects[id].yMin),
			new Vector2(AtlasManager.rects[id].xMin, AtlasManager.rects[id].yMin)
		};

        fade_in = new GameObject("Fade_In", typeof(Fade_In));
        Fade_Out.fade_out_begin = false;
        Fade_Out.fade_out_terminated = false;
    }

    void Update()
    {
		if (Input.GetKeyDown(KeyCode.Space))
		{
			Database.Load_Database();
		}
    }

    void OnGUI()
    {	
		GUI.skin.box.fontSize = 15;
		GUI.skin.box.wordWrap = false;



		GUI.Box(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 150, 300, 30), "Deveria escrever aqui!");

		//GUI.Button(new Rect(Screen.width / 2 - 40, Screen.height / 2 - 15 , 80, 30), "Easy");

		for (int i = 0; i < 6; i++)
		{
			GUI.Button(new Rect(Screen.width / 2 - 40, Screen.height / 2 - 15 + (i * 40), 80, 30), "Easy");
		}

		for (int i = 0; i < 6; i++)
		{
			GUI.Button(new Rect(Screen.width / 2 - 170, Screen.height / 2 - 15 + (i * 40), 80, 30), "Easy");
		}
    }
}
